/**
 * Project: apollo-base-dal
 * 
 * File Created at 2016年4月30日
 * 
 * Copyright 2015-2016 dx.com Croporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DongXue software Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with dx.com.
 */
package com.dx.pf.dal.router.dataSource;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/** 
* @ClassName: DynamicDataSource 
* @Description: 动态数据源
* @author wuzhenfang(wzfbj2008@163.com)
* @date 2016年4月30日 上午11:52:18 
* @version V1.0 
*/
public class DynamicDataSource extends AbstractRoutingDataSource {

	/**
	 * 也就是实现了数据源奇幻要扩展的方法，该方法的返回值就是项目中所要用的DataSource的key值，
	 * 拿到该key后就可以在resolvedDataSource中取出对应的DataSource，
	 * 如果key找不到对应的DataSource就使用默认的数据源。
	 */
	@Override
	protected Object determineCurrentLookupKey() {
		return DynamicDataSourceContextHolder.getCustomerType();
	}
}
